<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@page import="cn.jdy.framework.util.IpUtil"%>
<%
	String ip =IpUtil.getIp(request);// 访问者IP
	request.setAttribute("ipaddress", ip);
	%>
<!DOCTYPE html>


<html lang="en" class="no-js">

<head>
<jsp:include page="../common/common.jsp" />
</head>
<body class="page-header-fixed">
	<jsp:include page="../common/header.jsp" />
	<div class="clearfix"></div>
	<div class="page-container">
		<div class="page-sidebar-wrapper"><jsp:include
				page="../common/menu.jsp" /></div>
		<div class="page-content-wrapper">
			<div class="page-content">
				<div class="row">
					<div class="col-md-12">
						<form class="form-horizontal form-row-seperated" id="form"
							method="post" action="${path}/lhkgajExecl/save">
							<div class="portlet box purple">
								<div class="portlet-title">
									<div class="caption">
										<i class="fa fa-shopping-cart"></i>execl导入派工单详细内容
									</div>
									<div class="actions btn-set">
										<input class="btn default" type="button" value="取消" onclick="javascript:history.go(-1);">
										
										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>

									</div>
								</div>
								<div class="portlet-body">
									<div class="tabbable">
										<div class="tab-content no-space">
											<div class="tab-pane active" id="tab_general">
												<div class="form-body">
													<div class="form-group">
														<label class="col-md-2 control-label">栏目: <span
															class="required">*</span>
														</label>

														<div class="col-md-3">
															<select id="pid" class="form-control" name="pid">
																<c:forEach items="${column}" var="s">
																	<option value="${s.id}"
																		<c:if test="${data.cv.id == s.id}">selected</c:if>>${s.value0}</option>
																	
																</c:forEach>
															</select>
														</div>
														
													</div>
													<div class="form-group">
													<label class="col-md-2 control-label">发布时间: </label>

													<div class="col-md-5">
														<input id="falseCreateTime" name="falseCreateTime"
															type="text" class="form-control tags medium"
															value="${fn:substring(data.falseCreateTime,0,19)}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
													</div>
													</div>
													<input type="hidden" id="imgUrl"
													name="imgUrl" class="form-control" value="${data.imgUrl}" />
												<input type="hidden" id="xlsUrl"
													name="xlsUrl" class="form-control" value="${data.xlsUrl}" />
												
												<div class="form-group">
													<label class="col-md-2 control-label">execl文件1：</label>

													<div class="col-md-8">
														<div class="fileinput fileinput-new"
															data-provides="fileinput">
															<input type="text" id="isexecl1" name="isexecl1" class="form-control" style="width:430px" value="${data.isexecl1}" />
																<span class="btn default btn-file"> <span
																	class="fileinput-new"> 选择文件 </span> <span
																	class="fileinput-exists"> 修改文件  </span> <input
																	type="file" id="file1" name="file1" onchange="handleFile1()" />
																</span> <a href="#" class="btn default fileinput-exists"
																	data-dismiss="fileinput"> 移除文件  </a>
																	<script>
																		 var file1 = document.getElementById("file1");
																		        var fileName1 = document.getElementById("isexecl1");
																		        function handleFile1(){
																		            fileName1.value = file1.value.substring(12,50);
																		        }
																	</script>
															</div>
														</div>
													</div>
												</div>
											
												<div class="form-group">
													<label class="col-md-2 control-label">execl文件2：</label>

													<div class="col-md-8">
														<div class="fileinput fileinput-new"
															data-provides="fileinput">
															<input type="text" id="isexecl2" name="isexecl2" class="form-control" style="width:430px" value="${data.isexecl2}" />
																<span class="btn default btn-file"> <span
																	class="fileinput-new"> 选择文件 </span> <span
																	class="fileinput-exists"> 修改文件  </span> <input
																	type="file" id="file2" name="file2" onchange="handleFile2()" />
																</span> <a href="#" class="btn default fileinput-exists"
																	data-dismiss="fileinput"> 移除文件  </a>
																	<script>
																		 var file2 = document.getElementById("file2");
																		        var fileName2 = document.getElementById("isexecl2");
																		        function handleFile2(){
																		            fileName2.value = file2.value.substring(12,50);
																		        }
																	</script>
															</div>
														</div>
													</div>
												</div>
													<input type="hidden" id="value1" name="value1"
																class="form-control measure-input" datatype="*1-80"
																value="${data.value1}" />
													<input type="hidden" id="value2" name="value2"
																class="form-control measure-input" datatype="*1-80"
																value="${data.value2}" />
													<input type="hidden" id="value3" name="value3"
																class="form-control measure-input" datatype="*1-80"
																value="${data.value3}" />
													<input type="hidden" id="value4" name="value4"
																class="form-control measure-input" datatype="*1-80"
																value="${data.value4}" /> 
													<input type="hidden" id="value5" name="value5"
																class="form-control measure-input" 
																value="${data.value5}" />
													<input type="hidden" id="value6" name="value6"
																class="form-control measure-input" 
																value="${data.value6}" />
													<input type="hidden" id="value7" name="value7"
																class="form-control measure-input" 
																value="${data.value7}" />
													<input type="hidden" id="value8" name="value8"
																class="form-control measure-input" 
																value="${data.value8}" />
													<input type="hidden" id="value9" name="value9"
																class="form-control measure-input" 
																value="${data.value9}" />
													<input type="hidden" id="value10" name="value10"
																class="form-control measure-input" 
																value="${data.value10}" />
													<input type="hidden" id="value11" name="value11"
																class="form-control measure-input" 
																value="${data.value11}" />
													<input type="hidden" id="value12" name="value12"
																class="form-control measure-input" 
																value="${data.value12}" />
													<input type="hidden" id="value13" name="value13"
																class="form-control measure-input" 
																value="${data.value13}" />
													<input type="hidden" id="value14" name="value14"
																class="form-control measure-input" 
																value="${data.value14}" />
													<input type="hidden" id="value15" name="value15"
																class="form-control measure-input" 
																value="${data.value15}" />
													<input type="hidden" id="value16" name="value16"
																class="form-control measure-input" 
																value="${data.value16}" />
													<input type="hidden" id="value17" name="value17"
																class="form-control measure-input" 
																value="${data.value17}" />
													<input type="hidden" id="value18" name="value18"
																class="form-control measure-input" 
																value="${data.value18}" />
													<input type="hidden" id="value19" name="value19"
																class="form-control measure-input" 
																value="${data.value19}" />
													<input type="hidden" id="value20" name="value20"
																class="form-control measure-input" 
																value="${data.value20}" />
													<input type="hidden" id="value21" name="value21"
																class="form-control measure-input" 
																value="${data.value21}" />
													<input type="hidden" id="value22" name="value22"
																class="form-control measure-input" 
																value="${data.value22}" />
													<input type="hidden" id="value23" name="value23"
																class="form-control measure-input" 
																value="${data.value23}" />
													<input type="hidden" id="value24" name="value24"
																class="form-control measure-input" 
																value="${data.value24}" />
													<input type="hidden" id="value25" name="value25"
																class="form-control measure-input" 
																value="${data.value25}" />
													<input type="hidden" id="value26" name="value26"
																class="form-control measure-input" 
																value="${data.value26}" />
													<input type="hidden" id="value27" name="value27"
																class="form-control measure-input" 
																value="${data.value27}" />
													<input type="hidden" id="value28" name="value28"
																class="form-control measure-input" 
																value="${data.value28}" />
													<input type="hidden" id="value29" name="value29"
																class="form-control measure-input" 
																value="${data.value29}" />
													<input type="hidden" id="value30" name="value30"
																class="form-control measure-input" 
																value="${data.value30}" />
													<input type="hidden" id="value31" name="value31"
																class="form-control measure-input" 
																value="${data.value31}" />
													<input type="hidden" id="value32" name="value32"
																class="form-control measure-input" 
																value="${data.value32}" />
													<input type="hidden" id="value33" name="value33"
																class="form-control measure-input" 
																value="${data.value33}" />
													<input type="hidden" id="value34" name="value34"
																class="form-control measure-input" 
																value="${data.value34}" />
													<input type="hidden" id="value35" name="value35"
																class="form-control measure-input" 
																value="${data.value35}" />
													<input type="hidden" id="value36" name="value36"
																class="form-control measure-input" 
																value="${data.value36}" />
													<input type="hidden" id="value37" name="value37"
																class="form-control measure-input" 
																value="${data.value37}" />
													<input type="hidden" id="value38" name="value38"
																class="form-control measure-input" 
																value="${data.value38}" />
													<input type="hidden" id="value39" name="value39"
																class="form-control measure-input" 
																value="${data.value39}" />
													<input type="hidden" id="value40" name="value40"
																class="form-control measure-input" 
																value="${data.value40}" />
													<input type="hidden" id="value41" name="value41"
																class="form-control measure-input" 
																value="${data.value41}" />
													<input type="hidden" id="value42" name="value42"
																class="form-control measure-input" 
																value="${data.value42}" />
													<input type="hidden" id="value43" name="value43"
																class="form-control measure-input" 
																value="${data.value43}" />
													<input type="hidden" id="value44" name="value44"
																class="form-control measure-input" 
																value="${data.value44}" />
													<input type="hidden" id="value45" name="value45"
																class="form-control measure-input" 
																value="${data.value45}" />
													<input type="hidden" id="value46" name="value46"
																class="form-control measure-input" 
																value="${data.value46}" />
													<input type="hidden" id="value47" name="value47"
																class="form-control measure-input" 
																value="${data.value47}" />
													<input type="hidden"  id="value48" name="value48"
																class="form-control measure-input"
																value="${data.value48}" />
													<input type="hidden" id="value49" name="value49"
																class="form-control measure-input" 
																value="${data.value49}" />
													<input type="hidden"  id="value50" name="value50"
																class="form-control measure-input"
																value="${data.value50}" />
													<input type="hidden"  id="value51" name="value51"
																class="form-control measure-input"
																value="${data.value51}" />
													<input type="hidden"  id="value52" name="value52"
																class="form-control measure-input"
																value="${data.value52}" />
													<input type="hidden"  id="value53" name="value53"
																class="form-control measure-input"
																value="${data.value53}" />
												</div>
												
												
											</div>
										</div> 

								<div class="portlet-title">
									<div class="actions btn-set">
										<input class="btn default" type="button" value="取消" onclick="javascript:history.go(-1);">


										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>
									</div>
								</div>
							</div>
					</div>
					<input type="hidden"   id="id" name="id" value="${data.id}">
					<input type="hidden" name="topTime" id="topTime" value="${data.topTime==null?0:data.topTime}" /> 
					<input type="hidden" name="readTimes" id="readTimes" value="${data.readTimes}" /> 
					<input type="hidden" id=iseverymouth name="iseverymouth" value="${data.iseverymouth==null?0:data.iseverymouth}">
					<input type="hidden" id=iscolums name="iscolums" value="${data.iscolums==null?0:data.iscolums}">
					<input type="hidden" id="status" name="status" value="${data.status==null?1:data.status}" /> 
					<input type="hidden" id="zisNews" name="isNews" value="${data.isNews==null?1:data.isNews}" /> 
					<input type="hidden" id="teams" name="teams" value="${ipaddress}" /> 
					<input type="hidden" id="username" name="username" value="${user.username}">
					<input type="hidden" name="isarticle"  id="isarticle"  value="0"  /> 
					<input type="hidden" id="summary" name="summary" value="${data.summary==null?user.username:data.summary}">
					<c:if test="${data.signStatus!=null}">
								<input type="hidden" name="signStatus" id="signStatus"
									value="${data.signStatus}" />
					</c:if>
  	                <input type="hidden" id="signDepartment" name="signDepartment" >
					</form>
				</div>
			</div>
		</div>
	</div>
	</div>
<%-- 	<script type="text/javascript">
		var radiostate = 0;
		function radioChangeNews(em) {
			var v = $(em).val();
			if (v == "1") {
				document.getElementById('isNews').checked = false;
				$(em).val("0");
				$("#zisNews").val("0");
			} else {
				document.getElementById('isNews').checked = true;
				$(em).val("1");
				$("#zisNews").val("1");
			}

		}
	</script>  --%>
	<jsp:include page="../common/footer.jsp" />
	<script type="text/javascript" src="${path}/assets/plugins/calendar/WdatePicker.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
	<script type="text/javascript"
		src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
<!-- 	<script type="text/javascript" -->
<!-- 		src="${path}/assets/plugins/ueditor/ueditor.config.js"></script> -->
<!-- 	<script type="text/javascript" -->
<!-- 		src="${path}/assets/plugins/ueditor/ueditor.all.min.js"></script> -->
<!-- 	<script type="text/javascript" -->
<!-- 		src="${path}/assets/plugins/ueditor/lang/zh-cn/zh-cn.js"></script> -->
	<script type="text/javascript"
		src="${path}/assets/plugins/district/linkagesel-min.js"></script>
	<script type="text/javascript" src="${path}/operate/js/topDz.js"></script>
	<script>
		var operType = '${operType}';
		var editor, form;

		$(function() {

			//UE.getEditor('editor');
			form = $("form").Validform({
				tiptype : function(msg, o, cssctl) {
					//msg：提示信息;
					//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
					//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
					if (!o.obj.is("form")) {//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
						var objtip = o.obj.siblings(".Validform_checktip");
						cssctl(objtip, o.type);
						objtip.text(msg);
					} else {
						var objtip = o.obj.find("#msgdemo");
						cssctl(objtip, o.type);
						objtip.text(msg);
					}
				},
				postonce : true,
				showAllError : true,
				callback : function() {
					save();
				}
			});
		});
		//选择文章状态
// 		function seleceStatus(em) {

// 			$('[name="status"]').val($(em).val());
// 		}
		//设置这个文章有效
// 		function saveOk() {
// 			$('[name="status"]').val("1");
// 			save();
// 		}
		//设置这个文章无效
// 		function saveRm() {
// 			$('[name="status"]').val("8");
// 			save();
// 		}
		//取消设置这个文章封面
// 		function saveRmimg() {
// 			$('[name="imgUrl"]').val("");
// 			save();
// 		}
		//设置置顶
// 		function saveDz() {
// 			$('[name="topTime"]').val("1");
// 			save();
// 		}
		//取消设置置顶
// 		function saveRmdz() {
// 			$('[name="topTime"]').val("0");
// 			save();
// 		}
		//设置公安要闻第一
// 		function saveYwdy() {
// 			$('[name="status"]').val("3");
// 			save();
// 		}
		//取消设置公安要闻第一
// 		function saveRmYwdy() {
// 			$('[name="status"]').val("1");
// 			save();
// 		}
		function save() {

			if ($("#file1").val() !== "" && $("#file2").val() !== "") {
				if ($("#file1").val() !== "" ) {	
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						secureuri : false,
						fileElementId : 'file1',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#imgUrl").val(data.uri);
								
								if ($("#file2").val() !== ""){
									$.ajaxFileUpload({
										url : '${path}/conf/upload',
										secureuri : false,
										fileElementId : 'file2',
										dataType : 'json',
										success : function(data, status) {
											if (data.statusCode == 200) {
												$("#xlsUrl").val(data.uri);
												App.ajax(_path + "/lhkgajExecl/save", $("form")
														.serialize(), function(data) {
													if (data.statusCode == 200) {
														App.bubble(200, "更新成功！");
														window.setTimeout(function() {
															history.go(-1);//修改成功，弹出新页面，直接关闭
														}, 400);
													} else if (data.statusCode == 100) {
														App.bubble(100, "添加成功！");
														window.setTimeout(function() {
															history.go(-1);//返回上一级
															//window.close();
														}, 400);
													} else {
														App.bubble(500, "信息失败！");
														// alert("信息失败")
													}
												});

												//                         $("#form").submit();
											} else
												alert(data.info);
										}
									});
								} 
							} else
								alert(data.info);
						}
					});
				}
			}
			if ($("#file1").val() == "" && $("#file2").val() !== "") {
				if ($("#file2").val() !== ""){
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						secureuri : false,
						fileElementId : 'file2',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#xlsUrl").val(data.uri);
								App.ajax(_path + "/lhkgajExecl/save", $("form")
										.serialize(), function(data) {
									if (data.statusCode == 200) {
										App.bubble(200, "更新成功！");
										window.setTimeout(function() {
											history.go(-1);//修改成功，弹出新页面，直接关闭
										}, 400);
									} else if (data.statusCode == 100) {
										App.bubble(100, "添加成功！");
										window.setTimeout(function() {
											history.go(-1);//返回上一级
											//window.close();
										}, 400);
									} else {
										App.bubble(500, "信息失败！");
										// alert("信息失败")
									}
								});

								//                         $("#form").submit();
							} else
								alert(data.info);
						}
					});
				} 
			}
			if ($("#file1").val() !== "" && $("#file2").val() == "") {
				if ($("#file1").val() !== ""){
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						secureuri : false,
						fileElementId : 'file1',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#imgUrl").val(data.uri);
								App.ajax(_path + "/lhkgajExecl/save", $("form")
										.serialize(), function(data) {
									if (data.statusCode == 200) {
										App.bubble(200, "更新成功！");
										window.setTimeout(function() {
											history.go(-1);//修改成功，弹出新页面，直接关闭
										}, 400);
									} else if (data.statusCode == 100) {
										App.bubble(100, "添加成功！");
										window.setTimeout(function() {
											history.go(-1);//返回上一级
											//window.close();
										}, 400);
									} else {
										App.bubble(500, "信息失败！");
										// alert("信息失败")
									}
								});

								//                         $("#form").submit();
							} else
								alert(data.info);
						}
					});
				} 
			}
			if ($("#file1").val() == "" && $("#file2").val() == "") {
				App.ajax(_path + "/lhkgajExecl/save", $("form").serialize(),
						function(data) {
							if (data.statusCode == 200) {
								App.bubble(200, "更新成功！");
								window.setTimeout(function() {
									//window.close();//修改成功，弹出新页面，直接关闭
									history.go(-1);
								}, 400);
							} else if (data.statusCode == 100) {
								App.bubble(100, "添加成功！");
								window.setTimeout(function() {
									history.go(-1);//返回上一级
									//window.close();
								}, 400);
							} else {
								App.bubble(500, "信息失败！");
								// alert("信息失败")
							}
						});
			}
			
				

				// 	        $("#form").submit();
			

		}
	</script>
</body>
</html>